package com.learn.eduauth.controller;

import com.learn.eduapi.entity.User;
import com.learn.eduapi.util.CookieUtil;
import com.learn.eduapi.util.JwtUtil;
import com.learn.eduapi.util.RsaUtil;
import com.learn.eduauth.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Slf4j
@RestController
public class UserController {

    @Autowired
    private IUserService userService;

    @RequestMapping("/user/load/{username}")
    public ResponseEntity<User> getUserByUsername(@PathVariable("username") String username){
        User user = userService.getUserByUsername(username);
        return ResponseEntity.ok(user);
    }

    @RequestMapping("/user/add")
    public ResponseEntity<String> addUser(){
        return ResponseEntity.ok("test add user!");
    }
}
